package Student;
import com.sun.xml.internal.ws.util.QNameMap;

import java.util.*;
class student{
    private String name;
    private int age;
    student(String name, int age){
        this.name = name;
        this.age = age;
    }
    public String toString(){
        return name+":"+age;
    }
}
public class Test {
    public static void main(String[] args) {
        HashMap<String,student> hm = new HashMap<String,student>();

        student s1 = new student("deng",15);
        student s2 = new student("li",14);
        student s3 = new student("wang",16);
        student s4 = new student("zhou",18);
        student s5 = new student("zhang",17);

        hm.put("001",s1);
        hm.put("002",s2);
        hm.put("003",s3);
        hm.put("004",s4);
        hm.put("005",s5);

        Set set = hm.entrySet();
        Iterator it = set.iterator();
        while(it.hasNext()){
            HashMap.Entry en = (HashMap.Entry)(it.next());
            Object key = en.getKey();
            Object val = en.getValue();
            System.out.println(key+":"+val.toString());
        }

    }
}
//HashMap集合存储学生对象并用一种方式遍历
//  键：String 学号
//  值：Student 学生对象

